#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as lines
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from mpl_toolkits.axes_grid1.inset_locator import (inset_axes, InsetPosition, mark_inset)

import Styles as myStyles

xLableSize = 30
yLabelSize = 30

xTickLabelSize = 20
yTickLabelSize = 20

legendSize = 18

#majorLocator = MultipleLocator(20)
majorFormatter = FormatStrFormatter('%d')
majorFormatter = FormatStrFormatter('%.1f')
majorFormatter = FormatStrFormatter('%.1e')
#minorLocator = MultipleLocator(5)

#plt.rc('font', family='serif')
#plt.rc('text', usetex=True)
plt.rcParams['font.family'] = "Dejavu Sans"
plt.rcParams['mathtext.rm'] = 'Dejavu Sans'
plt.rcParams['mathtext.default'] = 'regular' # regular, it

fig = plt.figure(figsize=(8,8))
fig.subplots_adjust(bottom=0.10,left=0.11, right=0.95,top=0.95)

ax = fig.add_subplot(111, facecolor='w')

lineDataX1, linedataY1 = np.linspace(1, 6, 10), np.linspace(9.5,9.5,10)
line1, = plt.plot(lineDataX1, linedataY1, 'k-', lw=myStyles.myLw, label='linestyle 1')

lineDataX2, linedataY2 = np.linspace(1, 6, 10), np.linspace(9,9,10)
line2, = plt.plot(lineDataX2, linedataY2, 'r--', lw=myStyles.myLw, label='linestyle 2')

lineDataX3, linedataY3 = np.linspace(1, 6, 10), np.linspace(8.5,8.5,10)
line3, = plt.plot(lineDataX3, linedataY3, 'g-.', lw=myStyles.myLw, label='linestyle 3')

lineDataX4, linedataY4 = np.linspace(1, 6, 10), np.linspace(8.0,8.0,10)
line4, = plt.plot(lineDataX4, linedataY4, 'b:', lw=myStyles.myLw, label='linestyle 4')

lineDataX5, linedataY5 = np.linspace(1, 6, 10), np.linspace(7.5,7.5,10)
line5, = plt.plot(lineDataX5, linedataY5, color='darkgoldenrod', linestyle='-', lw=myStyles.myLw, label='linestyle 5')

lineDataX6, linedataY6 = np.linspace(1, 6, 10), np.linspace(7.0,7.0,10)
line6, = plt.plot(lineDataX6, linedataY6, color='m', ls='--', lw=myStyles.myLw, label='linestyle 6')

plt.locator_params(axis='y', nbins=6)
plt.locator_params(axis='x', nbins=6)
ax.set_xlabel(r'$\rm {x}$', fontsize=xLableSize)
ax.set_ylabel(r'$u$', fontsize=yLabelSize)
ax.set_xlim(0,10)
ax.set_ylim(1.0,10)
plt.setp(ax.get_xticklabels(), fontsize=xTickLabelSize);
plt.setp(ax.get_yticklabels(), fontsize=yTickLabelSize);

plt.legend(loc=0,fontsize=legendSize, scatterpoints=1, numpoints=1, ncol=1, markerscale=None,framealpha=1,edgecolor='k')

plt.savefig('./lineDemo.eps')
plt.savefig('./lineDemo.png')

plt.show()


fig2 = plt.figure(figsize=(8,6))
fig2.subplots_adjust(bottom=0.12,left=0.10, right=0.97,top=0.95)

ax = fig2.add_subplot(111, facecolor='w')

pointDataX1, pointDataY1 = np.linspace(1, 6, 10), np.linspace(9.5,9.5,10)
point1, = plt.plot(pointDataX1, pointDataY1, 'ko', markersize=myStyles.myMarkerSize, label='Exp')

pointDataX2, pointDataY2 = np.linspace(1, 6, 10), np.linspace(9.0,9.0,10)
point2, = plt.plot(pointDataX2, pointDataY2, 'ko', markersize=myStyles.myMarkerSize, fillstyle='top', label='point 1')

pointDataX3, pointDataY3 = np.linspace(1, 6, 10), np.linspace(8.5,8.5,10)
point3, = plt.plot(pointDataX3, pointDataY3, 'rs', markersize=myStyles.myMarkerSize, fillstyle='bottom', label='point 2')

pointDataX4, pointDataY4 = np.linspace(1, 6, 10), np.linspace(8.0,8.0,10)
point4, = plt.plot(pointDataX4, pointDataY4, 'gD', markersize=myStyles.myMarkerSize, fillstyle= 'left', label='point 3')

pointDataX5, pointDataY5 = np.linspace(1, 6, 10), np.linspace(7.5,7.5,10)
point5, = plt.plot(pointDataX5, pointDataY5, 'b^', markersize=myStyles.myMarkerSize, fillstyle= 'right', label='point 4')

ax.set_xlabel(r'$x$', fontsize=xLableSize)
ax.set_ylabel(r'$u$', fontsize=yLabelSize)
ax.set_xlim(0,10)
ax.set_ylim(1.0,10)
plt.setp(ax.get_xticklabels(), fontsize=xTickLabelSize);
plt.setp(ax.get_yticklabels(), fontsize=yTickLabelSize);

plt.legend(loc=0,fontsize=legendSize, scatterpoints=1, numpoints=1, ncol=1, markerscale=None,framealpha=1,edgecolor='k')

plt.savefig('./pointDemo.eps')
plt.savefig('./pointDemo.png')

plt.show()



fig3 = plt.figure(figsize=(8,6))
fig3.subplots_adjust(bottom=0.12,left=0.10, right=0.97,top=0.95)

ax = fig3.add_subplot(111, facecolor='w')

lpDataX1, lpDataY1 = np.linspace(1, 6, 10), np.linspace(9.5,9.5,10)
lp1, = plt.plot(lpDataX1, lpDataY1, 'k-o', markersize=myStyles.myMarkerSize, fillstyle='full', lw=myStyles.myLw, label='linepoint 1')

lpDataX2, lpDataY2 = np.linspace(1, 6, 10), np.linspace(9.0,9.0,10)
lp2, = plt.plot(lpDataX2, lpDataY2, 'k--o', markersize=myStyles.myMarkerSize, fillstyle='top', lw=myStyles.myLw, label='linepoint 2')

lpDataX3, lpDataY3 = np.linspace(1, 6, 10), np.linspace(8.5,8.5,10)
lp3, = plt.plot(lpDataX3, lpDataY3, 'r-.s', markersize=myStyles.myMarkerSize, fillstyle='bottom', lw=myStyles.myLw,
        label='linepoint 3')

lpDataX4, lpDataY4 = np.linspace(1, 6, 10), np.linspace(8.0,8.0,10)
lp4, = plt.plot(lpDataX4, lpDataY4, 'g:D', markersize=myStyles.myMarkerSize, fillstyle='left', lw=myStyles.myLw, label='linepoint 4')

lpDataX5, lpDataY5 = np.linspace(1, 6, 10), np.linspace(7.5,7.5,10)
lp5, = plt.plot(lpDataX5, lpDataY5, 'b--^', markersize=myStyles.myMarkerSize, fillstyle='right', lw=myStyles.myLw, label='linepoint 5')

#ax.grid(True)
ax.set_xlabel(r'$x$', fontsize=xLableSize)
ax.set_ylabel(r'$u$', fontsize=yLabelSize)
ax.set_xlim(0,10)
ax.set_ylim(1.0,10)
plt.setp(ax.get_xticklabels(), fontsize=xTickLabelSize);
plt.setp(ax.get_yticklabels(), fontsize=xTickLabelSize);

#ax.xaxis.set_major_locator(majorLocator)
#ax.xaxis.set_major_formatter(majorFormatter)

# for the minor ticks, use no labels; default NullFormatter
#ax.xaxis.set_minor_locator(minorLocator)
#ax.text(1, 1.6, tex, fontsize=20, va='bottom')

#line2, = plt.plot(xdata, ydata, label='Instant')
plt.legend(loc='upper right',fontsize=legendSize, scatterpoints=1, numpoints=1, ncol=1, markerscale=None,framealpha=1,edgecolor='k')

plt.savefig('./lpDemo.eps')
plt.savefig('./lpDemo.png')
plt.show()

fig = plt.figure(figsize=(8,6))
fig.subplots_adjust(bottom=0.12,left=0.10, right=0.97,top=0.95)

ax = fig.add_subplot(111, facecolor='w')

lineDataX1, linedataY1 = np.linspace(1, 6, 10), np.linspace(9.5,9.5,10)
line1, = plt.plot(lineDataX1, linedataY1, 'k-', lw=myStyles.myLw, label='Solid')

lineDataX2, linedataY2 = np.linspace(1, 6, 10), np.linspace(9,9,10)
line2, = plt.plot(lineDataX2, linedataY2, 'r--', lw=myStyles.myLw, label='dashed')

lineDataX3, linedataY3 = np.linspace(1, 6, 10), np.linspace(8.5,8.5,10)
line3, = plt.plot(lineDataX3, linedataY3, 'g-.', lw=myStyles.myLw, label='dashdotted', linestyle=myStyles.linestyles['dashdotted'])

lineDataX4, linedataY4 = np.linspace(1, 6, 10), np.linspace(8.0,8.0,10)
line4, = plt.plot(lineDataX4, linedataY4, 'b', lw=myStyles.myLw, label='dotted', linestyle=myStyles.linestyles['dotted'])

lineDataX5, linedataY5 = np.linspace(1, 6, 10), np.linspace(7.5,7.5,10)
line5, = plt.plot(lineDataX5, linedataY5, color='darkgoldenrod', lw=myStyles.myLw, label='dashdotdotted', linestyle=myStyles.linestyles['dashdotdotted'])

lineDataX6, linedataY6 = np.linspace(1, 6, 10), np.linspace(7.0,7.0,10)
line6, = plt.plot(lineDataX6, linedataY6, color='m', lw=myStyles.myLw, label='dashdashdotted',
        linestyle=myStyles.linestyles['dashdashdotted'])


ax.set_xlabel(r'$x$', fontsize=xLableSize)
ax.set_ylabel(r'$u$', fontsize=yLabelSize)
ax.set_xlim(0,10)
ax.set_ylim(1.0,10)
plt.setp(ax.get_xticklabels(), fontsize=xTickLabelSize);
plt.setp(ax.get_yticklabels(), fontsize=yTickLabelSize);

plt.legend(loc=0,fontsize=legendSize, scatterpoints=1, numpoints=1, ncol=1, markerscale=None,framealpha=1,edgecolor='k')

plt.savefig('./lineDemo_2.eps')
plt.savefig('./lineDemo_2.png')

plt.show()

